<?php
session_start();
if (empty($_SESSION['username'])) {
    echo '<script type="text/javascript">window.location.href="index.php";</script>';
} else {
    $now = time();
    if ($now > $_SESSION['expire']) {
        session_destroy();
        echo '<script type="text/javascript">var r=confirm("Session expire (30 mins)!"); if(r==true){window.location.href="../index.php";}else{window.location.href="index.php";}</script>';
    } else {
        require '../model-db-connection/config.php';
        $config = require '../model-db-connection/qrc_conf.properties.php';
    }
}
?>
<div class="panel panel-yellow">
    <div class="panel-heading">
        <div class="row">
            <div class="col-xs-3">
                <i class="fa fa-shopping-cart fa-5x"></i>
            </div>
            <div class="col-xs-9 text-right">
                <?php
                $sqlCountPO = "SELECT count(*) as count_po FROM QRC_PO";
                $sqlCountInspection = "SELECT count(*) as count_inspec FROM QRC_INSPECTION";
                $queryGetCountPO = mysql_query($sqlCountPO);
                $queryGetCountInspec = mysql_query($sqlCountInspection);
                while ($rowPO = mysql_fetch_assoc($queryGetCountPO)) {
                    while ($rowInspec = mysql_fetch_assoc($queryGetCountInspec)) {
                        echo '<div class="huge">' . $rowPO['count_po'] . '/' . $rowInspec['count_inspec'] . ' </div>';
                    }
                }
                ?>

                <div>PO/Inspection</div>
            </div>
        </div>
    </div>
    <a href="../po-page/index-po.php">
        <div class="panel-footer">
            <span class="pull-left">View Details</span>
            <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
            <div class="clearfix"></div>
        </div>
    </a>
</div>